#include <stdio.h>

long factorial_loop(int n)
{
    long result = 1;
    for (int i = 1; i <= n; i++)
    {
        result *= i;
    }
    return result;
}

int main()
{
    int n;
    printf("输入一个正整数：");
    scanf("%d", &n);

    if (n < 0)
    {
        printf("输入非负整数！\n");
    }
    else
    {
        printf("%d! = %ld \n", n, factorial_loop(n));
    }

    return 0;
}